-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix block transform preview height #44076
Conversation
Size Change: +40 B (0%) Total Size: 1.25 MB
ℹ️ View Unchanged
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am testing, but will attach a screencast later, as it appears to be affecting the |
I have confirmed that strange misalignments occur in the normal block inserter. On trunkOn this branchThis problem seems to be related to It looks like |
Nice catch, @t-hamano 👍 |
Thanks for catching that @t-hamano! I've pushed your suggested fix. That does resolve the issue in my testing. |
What?
Fixes #43829
This is possibly a regression from #38516, though it may also be related to changes to
useResizeObserver
. It's hard to say—it seems unusual that #38516 was merged quite a while ago, but this issue has only just been spotted.How?
#38516 added a
position
ofrelative
for the iframe's body element to fix an issue with pattern previews. It did this because the react resize aware docs suggest to do this (https://github.com/FezVrasta/react-resize-aware#usage):I think the problem with
relative
is that the listener doesn't take margin into account since the margin collapses.Using a position like
absolute
seems to fix things since margin won't collapse in an absolute container (https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Box_Model/Mastering_margin_collapsing). Changing toabsolute
required setting awidth: 100%
as otherwise blocks likecover
wouldn't take up full width.Testing Instructions
Expected: The heading block should be fully visible in the preview
Also test that this didn't regress block pattern previews as described in #38501, since this PR changes the fix for that issue.
Screenshots or screencast
Before
After